<template>
  <div class="wrap">
    <!-- 搜索 -->
    <div>
      <el-card style="width: 100%; height: 100%">
        <TitleLook :title="'优化目标选择'"> </TitleLook>

        <div style="width: 100%; height: 5%; margin: 1%">
          <el-radio-group
            v-model="form.energyPlanTarget"
            @input="radioChangeValueFn"
          >
            <el-radio :label="'促进新能源消纳'">促进新能源消纳</el-radio>
            <el-radio :label="'提升供电可靠性'">提升供电可靠性</el-radio>
          </el-radio-group>
        </div>

        <TitleLook :title="'因素输入'"> </TitleLook>

        <div>
          <el-form
            ref="ruleForm"
            :model="form"
            label-width="180px"
            :rules="rules"
          >
            <el-row>
              <el-col :span="8">
                <el-form-item label="规划方案名称:" prop="planName">
                  <el-input v-model="form.planName"></el-input>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="功率约束:" prop="pConstraint">
                  <el-input v-model="form.pConstraint">
                    <template slot="append">kW</template>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="8">
                <el-form-item label="容量约束:" prop="energyConstraint">
                  <el-input v-model="form.energyConstraint">
                    <template slot="append">kWh</template>
                  </el-input>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="数量约束:" prop="countConstraint">
                  <el-input v-model="form.countConstraint">
                    <template slot="append">台</template>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="8">
                <el-form-item label="规划对象（变电站）:" prop="ghdxbdz">
                  <el-select
                    v-model="form.ghdxbdz"
                    placeholder="规划对象（变电站)"
                    style="width: 100%"
                    @change="changeFeederFn"
                  >
                    <el-option
                      v-for="item in stationOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="规划对象（馈线）:" prop="feederId">
                  <el-select
                    v-model="form.feederId"
                    placeholder="规划对象（馈线)"
                    style="width: 100%"
                  >
                    <el-option
                      v-for="item in lineOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>

            <el-form-item>
              <el-button @click="resetForm('ruleForm')">重置</el-button>
              <el-button type="primary" @click="onSubmit()">生成方案</el-button>
            </el-form-item>
          </el-form>
        </div>

        <el-dialog
          title="正在生成"
          :visible.sync="dialogVisible"
          width="30%"
          :before-close="handleClose"
          @opened="open()"
        >
          <span>
            <el-progress
              :percentage="percentage"
              :color="customColorMethod"
            ></el-progress>
          </span>
          <span>正在进行潮流计算，大约剩余2s生成储能规划方案</span>
          <span slot="footer" class="dialog-footer">
            <el-button type="primary" @click="cancel()">取消生成</el-button>
          </span>
        </el-dialog>
      </el-card>
    </div>
  </div>
</template>
<script>
import TestResult from "./index.js";
export default TestResult;
</script>
<style lang="scss" scoped>
::v-deep .el-tree {
  height: 100% !important;
  overflow-x: auto !important;
}

::v-deep .el-card__body {
  height: calc(95% - 20px) !important;
}

::v-deep .el-tree-node:focus > .el-tree-node__content {
  background-color: #f2f2f2;
}

.table-html-wrap {
  overflow: hidden;
  overflow-y: auto;
}

.table-html-wrap ::v-deep table {
  // color: red;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  border-collapse: collapse;
  margin: auto;
}

.table-html-wrap ::v-deep table td {
  border-left: 1px solid #000;
  border-top: 1px solid #000;
  white-space: nowrap;
  text-align: center;
  padding: 0.5rem;
}

.table-html-wrap ::v-deep tbody tr:nth-of-type(1) {
  font-weight: bold;
  font-size: 20px;
}

.dialog-footer {
  text-align: end;
}

.wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;

  > div:nth-child(1) {
    width: 100%;
    height: 100%;
  }

  /* background-color: rgb(195, 188, 241); */
}

.title {
  border: 1px solid grey;
  border-radius: 4px;
  width: 200px;
  text-align: center;
}

.operateButton {
  cursor: pointer;
  font-size: 12px !important;
  padding: 8px;

  img {
    transform: translateY(-2px);
  }
}

.operateButton::after {
  display: inline-block;
  content: "";
  width: 1px;
  height: 18px;
  margin: 0 3px;
  transform: translate(6px, 3px);
  background: #000;
}

.operateButton:last-child::after {
  display: none;
}

::v-deep .el-select--mini {
  width: 100%;
}

::v-deep .el-date-editor {
  width: 100%;
}

::v-deep .el-scrollbar__thumb {
  background: #000;
  display: none;
}

// ::-webkit-scrollbar-thumb {
//   // display: none;
// }
::v-deep .el-table__empty-block {
  justify-content: left;
  text-align: left;
  padding-left: 40%;
}

::v-deep .el-select-dropdown {
  position: absolute !important;
  top: 80% !important;
  left: 0px !important;
}

::v-deep .el-card {
  border-radius: 4px;
  border: 1px solid #ebeef5;
  background-color: #fff;
  overflow: visible !important; //溢出不隐藏   隐藏的话，下拉框看不到全部数据
  color: #303133;
  transition: 0.3s;
  height: 100%;
}

.allDIV {
  border-radius: 4px;
  border: 1px solid #ebeef5;
  background-color: #fff;
  overflow: visible !important; //溢出不隐藏   隐藏的话，下拉框看不到全部数据
  color: #303133;
  transition: 0.3s;
  height: 100%;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.underTitle {
  width: 100%;
  height: 90%;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-content: center;
}

.child_right {
  // @include child_left;
  width: 100%;
  height: 50%;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
  // margin-top: 20%;
}

.left_text1 {
  display: flex;
  justify-content: center;
  text-align: center;
  align-content: center;
  vertical-align: middle;
  /* 垂直居中 */
  font-family: Source Han Sans CN;
  font-weight: bold;
  // font-size: 40px;
  color: #ffffff;
  background: linear-gradient(to bottom, #ffffff 0%, #8dc9ec 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.zerostyle {
  width: 20%;
  height: 100%;
  color: aliceblue;
  justify-content: space-around;
  display: flex;
  flex-direction: column;
  > div:nth-child(n) {
    background: linear-gradient(to top, rgb(76, 197, 176), rgb(119, 217, 230));

    border-radius: 5px;
    width: 90%;
    height: 20%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }
}

.right_bottom {
  width: 100%;
  height: 30%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: space-around;
  > div:nth-child(n) {
    width: 48%;
    height: 35%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-content: center;
    > div:nth-child(n) {
      display: flex;
      flex-direction: column;
      width: 100%;
      justify-content: space-around;
      background: linear-gradient(
        to top,
        rgb(76, 197, 176),
        rgb(146, 218, 143)
      );
      width: 60%;
      border-radius: 10px;
      color: #fff;
      align-content: center;
    }
  }
}

.chartBox {
  width: 100%;
  display: flex;
  justify-content: center;
  height: 100%;
}

::v-deep .el-form-item {
  // display: flex;
}

::v-deep .el-form-item__content {
  // display: flex;
  // width: 80%;
  // justify-content: space-around;
}
</style>
